/*
 Navicat Premium Dump SQL

 Source Server         : 127.0.0.1
 Source Server Type    : MySQL
 Source Server Version : 50744 (5.7.44)
 Source Host           : 127.0.0.1:3306
 Source Schema         : smart_community

 Target Server Type    : MySQL
 Target Server Version : 50744 (5.7.44)
 File Encoding         : 65001

 Date: 13/09/2025 15:09:14
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for sc_role
-- ----------------------------
DROP TABLE IF EXISTS `sc_role`;
CREATE TABLE `sc_role` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '角色ID',
  `role_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '角色名称',
  `role_code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '角色编码',
  `role_type` int(11) DEFAULT '1' COMMENT '角色类型：1-系统角色，2-自定义角色',
  `data_scope` int(11) DEFAULT '1' COMMENT '数据权限：1-全部，2-本社区，3-本组织，4-仅自己',
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '角色描述',
  `sort_order` int(11) DEFAULT '0' COMMENT '排序',
  `status` int(11) DEFAULT '1' COMMENT '状态：0-禁用，1-启用',
  `create_by` bigint(20) DEFAULT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` bigint(20) DEFAULT NULL COMMENT '更新人',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `deleted` int(11) DEFAULT '0' COMMENT '是否删除：0-否，1-是',
  `version` int(11) DEFAULT '1' COMMENT '版本号',
  `is_builtin` tinyint(1) DEFAULT '0' COMMENT '是否内置角色',
  `remark` text COLLATE utf8mb4_unicode_ci COMMENT '备注',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_role_code` (`role_code`),
  KEY `idx_role_type` (`role_type`),
  KEY `idx_status` (`status`),
  KEY `idx_sort_order` (`sort_order`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='角色表';

-- ----------------------------
-- Records of sc_role
-- ----------------------------
BEGIN;
INSERT INTO `sc_role` (`id`, `role_name`, `role_code`, `role_type`, `data_scope`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `is_builtin`, `remark`) VALUES (1, '超级管理员', 'SUPER_ADMIN', 1, 1, '系统超级管理员，拥有所有权限', 1, 1, 1, '2025-06-22 08:12:36', 1, '2025-07-09 05:24:42', 0, 1, 0, NULL);
INSERT INTO `sc_role` (`id`, `role_name`, `role_code`, `role_type`, `data_scope`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `is_builtin`, `remark`) VALUES (2, '区域管理员', 'REGION_ADMIN', 1, 2, '区域管理员，管理多个社区', 2, 1, 1, '2025-06-22 08:12:36', 1, '2025-07-09 05:24:42', 0, 1, 0, NULL);
INSERT INTO `sc_role` (`id`, `role_name`, `role_code`, `role_type`, `data_scope`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `is_builtin`, `remark`) VALUES (3, '社区管理员', 'COMMUNITY_ADMIN', 1, 2, '社区管理员，管理单个社区', 3, 1, 1, '2025-06-22 08:12:36', 1, '2025-07-09 05:24:42', 0, 1, 0, NULL);
INSERT INTO `sc_role` (`id`, `role_name`, `role_code`, `role_type`, `data_scope`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `is_builtin`, `remark`) VALUES (4, '物业人员', 'PROPERTY_STAFF', 1, 3, '物业工作人员', 4, 1, 1, '2025-06-22 08:12:36', 1, '2025-07-09 05:24:42', 0, 1, 0, NULL);
INSERT INTO `sc_role` (`id`, `role_name`, `role_code`, `role_type`, `data_scope`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `is_builtin`, `remark`) VALUES (5, '安保人员', 'SECURITY_STAFF', 1, 3, '安保工作人员', 5, 1, 1, '2025-06-22 08:12:36', 1, '2025-07-09 05:24:42', 0, 1, 0, NULL);
INSERT INTO `sc_role` (`id`, `role_name`, `role_code`, `role_type`, `data_scope`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `is_builtin`, `remark`) VALUES (6, '维修人员', 'REPAIR_STAFF', 1, 3, '维修工作人员', 6, 1, 1, '2025-06-22 08:12:36', 1, '2025-07-09 05:24:42', 0, 1, 0, NULL);
INSERT INTO `sc_role` (`id`, `role_name`, `role_code`, `role_type`, `data_scope`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `is_builtin`, `remark`) VALUES (7, '居民', 'RESIDENT', 1, 4, '社区居民', 7, 1, 1, '2025-06-22 08:12:36', 1, '2025-07-09 05:24:42', 0, 1, 0, NULL);
INSERT INTO `sc_role` (`id`, `role_name`, `role_code`, `role_type`, `data_scope`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `is_builtin`, `remark`) VALUES (9, '物业管理员', 'PROPERTY_ADMIN', 1, 2, '物业公司管理员', 2, 1, 1, '2025-07-05 15:20:05', 1, '2025-07-09 05:24:42', 0, 1, 0, NULL);
INSERT INTO `sc_role` (`id`, `role_name`, `role_code`, `role_type`, `data_scope`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `is_builtin`, `remark`) VALUES (10, '楼栋管理员', 'BUILDING_ADMIN', 1, 3, '楼栋管理员', 4, 1, 1, '2025-07-05 15:20:05', 1, '2025-07-09 05:24:42', 0, 1, 0, NULL);
INSERT INTO `sc_role` (`id`, `role_name`, `role_code`, `role_type`, `data_scope`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `is_builtin`, `remark`) VALUES (11, '单元管理员', 'UNIT_ADMIN', 1, 3, '单元管理员', 5, 1, 1, '2025-07-05 15:20:05', 1, '2025-07-09 05:24:42', 0, 1, 0, NULL);
INSERT INTO `sc_role` (`id`, `role_name`, `role_code`, `role_type`, `data_scope`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `is_builtin`, `remark`) VALUES (12, '房户管理员', 'HOUSEHOLD_ADMIN', 1, 4, '房户管理员', 6, 1, 1, '2025-07-05 15:20:05', 1, '2025-07-09 05:24:42', 0, 1, 0, NULL);
INSERT INTO `sc_role` (`id`, `role_name`, `role_code`, `role_type`, `data_scope`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `is_builtin`, `remark`) VALUES (13, '普通用户', 'NORMAL_USER', 1, 4, '普通居民用户', 7, 1, 1, '2025-07-05 15:20:05', 1, '2025-07-09 05:24:42', 0, 1, 0, NULL);
INSERT INTO `sc_role` (`id`, `role_name`, `role_code`, `role_type`, `data_scope`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `is_builtin`, `remark`) VALUES (14, '管理员', 'ADMIN', 1, 1, '普通管理员（预留角色）', 0, 1, 1, '2025-07-05 15:55:57', 1, '2025-07-17 09:39:39', 0, 1, 0, NULL);
INSERT INTO `sc_role` (`id`, `role_name`, `role_code`, `role_type`, `data_scope`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `is_builtin`, `remark`) VALUES (15, '业主', 'OWNER', 1, 4, '业主', 6, 1, 1, '2025-07-05 15:55:57', 1, '2025-07-17 09:39:39', 0, 1, 0, NULL);
INSERT INTO `sc_role` (`id`, `role_name`, `role_code`, `role_type`, `data_scope`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `is_builtin`, `remark`) VALUES (16, '安保管理', 'SECURITY_ADMIN', 1, 2, '安保管理人员，管理安保人员', 8, 1, 1, '2025-01-29 10:00:00', 1, '2025-01-29 10:00:00', 0, 1, 0, NULL);
INSERT INTO `sc_role` (`id`, `role_name`, `role_code`, `role_type`, `data_scope`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `is_builtin`, `remark`) VALUES (17, '保洁人员', 'CLEANING_STAFF', 1, 3, '保洁工作人员，负责社区卫生清洁', 9, 1, 1, '2025-01-29 10:00:00', 1, '2025-01-29 10:00:00', 0, 1, 0, NULL);
INSERT INTO `sc_role` (`id`, `role_name`, `role_code`, `role_type`, `data_scope`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `is_builtin`, `remark`) VALUES (18, '保洁管理', 'CLEANING_ADMIN', 1, 2, '保洁管理人员，管理保洁人员', 10, 1, 1, '2025-01-29 10:00:00', 1, '2025-01-29 10:00:00', 0, 1, 0, NULL);
INSERT INTO `sc_role` (`id`, `role_name`, `role_code`, `role_type`, `data_scope`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `is_builtin`, `remark`) VALUES (19, '停车人员', 'PARKING_STAFF', 1, 3, '停车工作人员，负责停车和充电收费管理', 11, 1, 1, '2025-01-29 10:00:00', 1, '2025-01-29 10:00:00', 0, 1, 0, NULL);
INSERT INTO `sc_role` (`id`, `role_name`, `role_code`, `role_type`, `data_scope`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `deleted`, `version`, `is_builtin`, `remark`) VALUES (20, '停车管理', 'PARKING_ADMIN', 1, 2, '停车管理人员，管理停车人员', 12, 1, 1, '2025-01-29 10:00:00', 1, '2025-01-29 10:00:00', 0, 1, 0, NULL);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
